<input type="submit" onclick="window.print()" value="<?= __('Print') ?>" class="right no-print" style="clear:none" />
<h1><?= strtotitle(__('members')) ?></h1>
<br clear="all">
<table width="100%" style="margin:0">
<tr>
    <th><?= implode(' ', array(strtotitle(__('firstname')),  __('and'), __('surname'))) ?></th>
    <th><?= strtotitle(__('registration date')) ?></th>
    <th><?= strtotitle(__('category')) ?></th>
    <th><?= strtotitle(__('choir')) ?></th>
    <th><?= strtotitle(__('voice')) ?></th>
    <th><?= strtotitle(__('functions')) ?></th>
    <th><?= strtotitle(__('birthday')) ?></th>
    <th><?= strtotitle(__('education')) ?></th>
    <th><?= strtotitle(__('passport')) ?></th>
</tr>
<? foreach($members as $member): ?>
<tr>
    <td><?= $member['Member']['name'] ?></td>
    <td><?= date_local($member['Member']['registration_date']) ?></td>
    <td><?= __($member['Member']['category']) ?></td>
    <td><?php
        $choirs = array();
        if ($member['Member']['choir_sex_mixed']) $choirs[] = __('mixed');
        if ($member['Member']['choir_sex_male']) $choirs[] = __('male');
        if ($member['Member']['choir_sex_female']) $choirs[] = __('female');
        
        echo implode(",<br>", $choirs);
    ?></td>
    <td><?= __($member['Member']['voice']) ?></td>
    <td><?php
        $functions = Set::extract('{n}.Function.name', $member['MemberChoirFunction']);
        foreach ($functions as &$f)
            $f = __($f);
            
        echo implode(",<br>", $functions);
    ?></td>
    <td><?= date_local($member['Member']['birthday']) ?></td>
    <td><?= __($member['Member']['education']) ?></td>
    <td><?php
        $number  = $member['Member']['passport_number'];
        $country = $member['Member']['passport_country'];
        
        echo $number . (empty($number) || empty($country) ? '' : ', ') . $country;
    ?></td>
</tr>
<? endforeach ?>
</table>